{
Alisa_Barkar
12/12/12
}
program Project1;

{$APPTYPE CONSOLE}

uses
  SysUtils;

type
  Rectangle = class
  private
    s:integer;
  public
    a,b:integer;
    procedure Square; virtual;
    procedure Update;
  end;
  SmartRectangle = class(Rectangle)
    procedure Square;override;
    procedure Set1 (newA, newB:integer);
  end;
  procedure Rectangle.Square;
  begin
    writeln(s);
  end;
  procedure Rectangle.Update;
  begin
    s:=a*b;
  end;
  procedure SmartRectangle.Set1(newA: Integer; newB: Integer);
  begin
    a:=newA;
    b:=newB;
    s:=a*b;
    writeln(s);
  end;
  procedure SmartRectangle.Square;
  begin
    if (s<>a*b) then
      writeln ('Error!!!');
  end;
var
  t: Rectangle;
begin
  t:=Rectangle.Create;
  t.a:=3;
  t.b:=7;
  t.Update;
  t.Square;
  t:=SmartRectangle.Create;
  t.Set1(3, 7);
  t.Square;
end.
